using System;
using System.Collections.Generic;
using System.Linq;
using Charisma.Conventions;
using Charisma.Tests.Models.Fake;
using NUnit.Framework;

namespace Charisma.Tests.Conventions
{
  [TestFixture]
  public class RepositoryConventionTests
  {
    [Test]
    public void NonGenericInterfaceRepositoryTest()
    {
      var convention = new PublicRepositoryConvention();
      Assert.IsFalse(convention.Find(typeof(FakeContext)).Any(r => r.Name == "NonGenericInterfaceRepository"));
    }

    [Test]
    public void GenericInterfaceRepositoryTest()
    {
      var convention = new PublicRepositoryConvention();
      Assert.IsTrue(convention.Find(typeof(FakeContext)).Any(r => r.Name == "GenericInterfaceRepository"));
    }

    [Test]
    public void GenericClassRepositoryTest()
    {
      var convention = new PublicRepositoryConvention();
      Assert.IsTrue(convention.Find(typeof(FakeContext)).Any(r => r.Name == "GenericClassRepository"));
    }

    [Test]
    public void InstanceClassRepositoryTest()
    {
      var convention = new PublicRepositoryConvention();
      Assert.IsTrue(convention.Find(typeof(FakeContext)).Any(r => r.Name == "InstanceClassRepository"));
    }

    [Test]
    public void FakeNonGenericInterfaceRepositoryTest()
    {
      var convention = new PublicRepositoryConvention();
      Assert.IsTrue(convention.Find(typeof(FakeContext)).Any(r => r.Name == "FakeNonGenericInterfaceRepository"));
    }

    [Test]
    public void FakeGenericInterfaceRepositoryTest()
    {
      var convention = new PublicRepositoryConvention();
      Assert.IsTrue(convention.Find(typeof(FakeContext)).Any(r => r.Name == "FakeGenericInterfaceRepository"));
    }

    [Test]
    public void FakeClassRepositoryTest()
    {
      var convention = new PublicRepositoryConvention();
      Assert.IsTrue(convention.Find(typeof(FakeContext)).Any(r => r.Name == "FakeClassRepository"));
    }
  }
}